#include "driver/gpio.h"

static gpio_num_t led_pin = GPIO_NUM_2;

void led_init(gpio_num_t pin) {
  led_pin = pin;
  // Initialize the LED GPIO pin
  gpio_config_t io_conf = {
      .pin_bit_mask = (1ULL << led_pin),
      .mode = GPIO_MODE_OUTPUT,
      .pull_up_en = GPIO_PULLUP_DISABLE,
      .pull_down_en = GPIO_PULLDOWN_DISABLE,
      .intr_type = GPIO_INTR_DISABLE,
  };
  gpio_config(&io_conf);
}

void turn_on() { gpio_set_level(led_pin, 1); }

void turn_off() { gpio_set_level(led_pin, 0); }